package ru.spbu.mm.diploma.server.dao;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import ru.spbu.mm.diploma.common.entity.RiskGroup;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Ksushenka
 * Date: 30.10.11
 * Time: 12:01
 * To change this template use File | Settings | File Templates.
 */
public class RiskGroupDAOImpl extends HibernateDaoSupport implements IRiskGroupDAO{
    public List<RiskGroup> getAllRiskGroup() {
     return  (List<RiskGroup>) this.getHibernateTemplate().loadAll(RiskGroup.class);
    }

    public RiskGroup getGroupByName(String name) {
        return (RiskGroup) this.getHibernateTemplate().findByNamedQueryAndNamedParam("findRiskGroupByName","groupName",name).get(0);
    }
}
